home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ian & Stuart's Australian Mac 1
/
Ian and Stuart's One (Australia).iso
/
Australasian Legends
/
Commercial
/
Rainbow Hill
/
MacDOS™ 2.0.0
/
User's Guide
/
13.1 ! - DEL
< prev
next >
Wrap
Text File
|
1994-09-20
|
30KB
|
775 lines
13 Command Reference
!, REM
identifies comments (REM stands for the word remark).
Syntax
![text]
REM [text]
Parameters
text
is one line of text which is ignored by MacDOS. Note that a
space is needed after the command name when the REM format
is used, while the exclamation mark can be immediately
followed by the text.
MacDOS vs DOS
DOS only supports the REM format.
Notes
Input and output redirection
As MacDOS ignores whatever text follows the remark
commands, I/O redirection and piping of remarks are not
"seen" by MacDOS.
Examples
!
REM
REM this is a remark
!*********** another remark ************
! we want to switch off the following command temporarily
!echo off
REMARK: rejected because REM is not followed by a space
ALARM
sets MacDOS' way of reporting errors and warnings.
Syntax
alarm [ ON | OFF ]
Parameters
[ ON | OFF ]
With ON, ALARM directs MacDOS to report errors and warnings
via alerts. When an alert is displayed, execution is
suspended until you acknowledge the message. With OFF,
ALARM directs MacDOS to report errors and warnings via
concise messages. Execution is not suspended. Without
parameters, ALARM reports the current setting.
MacDOS vs DOS
DOS does not support ALARM.
Examples
ALARM ON
alarm Off
alarm > aFile
CALL
starts a program while executing in batch without
terminating the current batch program.
Syntax
call program [batch parameters]
Parameters
program
is the filename of an application, an AppleScript, or a
batch program, possibly preceded by an absolute or relative
path.
batch parameters
parameters to be passed to the program if it is a batch.
Switches
There are no switches for the CALL command, although some
of the parameters for a batch program to be executed may
take the form of switches.
MacDOS vs DOS
The two implementations are identical, but MacDOS can
execute CALL from the prompt, while DOS only accepts it
within batch programs.
Notes
Output redirection
You can redirect the output of batch programs when you CALL
them, but CALL does not accept output redirection in any
other case.
Recursion
Recursive calls of Batch programs, whether directly or
through a chain of batch programs, is certain to cause an
error unless you use a terminating condition. This is due
to the fact that MacDOS supports a maximum of 16 nested
CALLs.
File extension
Batch filenames traditionally terminate with ".BAT", but do
not need to. When they do terminate with ".BAT", you do not
need to type it. MacDOS first attempts to locate the
filename as typed. If the search is unsuccessful, MacDOS
then appends the extension ".BAT" and tries again. As
MacDOS first tries to find a filename exactly as typed by
you, you have to be careful when the same folder contains
two files with the same name except for the terminating
".BAT". In that case, you need to type the ".BAT" in order
to distinguish between the two files. When MacDOS adds the
extension ".BAT", it expects to find a batch file and
reports an error in all other cases.
Examples
CALL A_BATCH %1 %2 %3
The currently executing batch program starts the batch file
A_BATCH and passes on to it its own first three parameters.
call "Microsoft Word"
The currently executing batch program launches MS Word and
then continues execution.
Frequently occurring errors
E27: File or directory not found
The CALLed program or one of the folders specified in the
path could not be found.
CD, CHDIR
change the current folder (ie. DIRectory) or display its
name.
Syntax
cd folder
chdir folder
The two commands are functionally identical.
Parameters
folder
is a name preceded by an absolute or relative path which
specifies the new folder. When you use two dots as folder
name, CD attaches to the folder which contains the current
folder. When you use as folder name a volume ID followed by
a colon, CD displays the current folder of the given
volume. Without folder name, CD displays the current volume
and folder.
MacDOS vs DOS
The two implementations are identical.
Examples
cd aFolder
attaches to the folder named aFolder and contained in the
current folder.
cd ..
attaches to the folder which contains the current folder.
In DOS, that folder is usually referred to as the "parent
directory".
chdir 1:\
attaches to the root folder of the start-up volume.
chdir 2:sub1\sub2
attaches to the sub2 folder contained in sub1, where sub1
is a folder contained in the current folder of volume 2.
cd "\desktop folder"
attaches to the folder which contains items displayed on
the desktop of the current volume.
Frequently occurring errors
E27: File or directory not found
The requested folder could not be found. Perhaps it exists
but on a different volume.
CLOSE
closes a file opened with the command OPEN.
Syntax
close fileID
Parameters
fileID
is the file-identification number returned by OPEN.
MacDOS vs DOS
DOS does not support CLOSE.
Notes
Errors
CLOSE does not generate an error message if it fails to
close a file. The intent is to encourage you to be on the
safe side and perhaps close the files more than once rather
than not at all.
Examples
close 3
CLOSE %FileID%
Frequently occurring errors
E13: Syntax: invalid arguments
The fileID was not a number. Perhaps you passed a variable
name without enclosing it between percent signs, or the
variable contained an alphabetic string.
See Also
OPEN, READ
CLS
clears the MacDOS window.
Syntax
cls
MacDOS vs DOS
The two implementations are identical.
CONFIRM
directs MacDOS to ask for confirmation before overwriting
or removing existing files.
Syntax
confirm [ ON | OFF ]
Parameters
[ ON | OFF ]
CONFIRM ON directs MacDOS to ask confirmation.
CONFIRM OFF directs MacDOS to stop asking for confirmation.
Without parameters, CONFIRM reports the current setting.
MacDOS vs DOS
DOS does not support CONFIRM.
Examples
confirm ON
confirm oFf
CONFIRM >aFile
COPY
copies one or more files between locations. Both data and
resource forks are copied.
Syntax
copy source [,...] [destination] [/A] [/C=creator] [/D]
[/P] [/R] [/T=file type] [/U] [/V]
Parameters
source [,...]
is a name preceded by an absolute or relative path which
specifies the file or group of files to be copied. A group
of files is identified via a wildcarded filename or a
folder name. To copy several sources, you can specify them
one after the other separated by commata.
destination
is a name preceded by an absolute or relative path which
specifies the file or folder to which the source[s] are to
be copied.
Switches
/A
directs MacDOS to append files to the destination file, so
that its initial content is preserved. This switch only
takes effect when the destination is an individual file.
/C=creator
specifies that only files of a particular creator are to be
copied. Note that no spaces are allowed on either side of
the equal sign and that the creator string is four
characters long. Therefore, if a creator includes spaces,
you must double quote the switch (eg. copy \ "/c=ABC "
copies all the files created by 'ABC ' in the root folder).
/D
specifies that only data forks are to be copied.
Nevertheless, when both /D and /R are ON, MacDOS behaves as
if they were both OFF; ie. it copies both forks.
/P
prompts you for confirmation before overwriting existing
destination files.
/R
specifies that only resource forks are to be copied.
Nevertheless, when both /D and /R are ON, MacDOS behaves as
if they were both OFF; ie. it copies both forks.
/T=file type
specifies that only files of a particular type (eg. TEXT)
are to be copied. Note that no spaces are allowed on either
side of the equal sign and that the file type is four
characters long. Therefore, if a file type includes spaces,
you must double quote the switch (eg. copy \ "/t=ABC "
copies all the files of type 'ABC ' in the root folder).
/U
specifies that source files overwrite existing destination
files only if the source was updated more recently.
/V
re-reads destination files to verify that they have been
copied correctly.
MacDOS vs DOS
Source
When you specify several sources in DOS, you must separate
them by plus signs. DOS then appends them to each other in
a very complex way. With MacDOS, you separate the sources
with commata and MacDOS merges them only if you specify a
single file as destination.
Destination
Wildcarded destinations are illegal in MacDOS. This
limitation is mainly due to the fact that wildcarding is
more powerful in MacDOS than in DOS. The matching of source
and destination wildcarded identifiers would have become
very complex and too difficult to use.
Copying empty files
Unlike DOS, MacDOS copies zero-length files.
Switches
MacDOS provides several switches which are not available in
DOS but does not provide the /A/B switches to distinguish
ASCII and binary copying. MacDOS always performs binary
copies.
Merging into one of the sources
When several files are merged into a single file which
coincides with one of the sources, MacDOS overwrites that
source with the result of the merging. Unlike DOS, MacDOS
performs correctly regardless of whether the destination
file coincides with the first source or with one of the
following sources.
Updating the date/time
In DOS, the command "copy source+,," assigns the current
date/time to a file. With MacDOS, you can achieve the same
result through the switch /D of the RENAME command.
Notes
Commata between source files
The comma is only allowed between source files. Therefore,
a list of sources must not terminate with a comma.
Creators, file types, and finder flags
When copying a file, MacDOS assigns to the destination the
same creator, file type, and finder flags. This is also
true when several files are merged into a single
destination file, but only if all individual source files
to be merged have identical parameters. When this is not
the case, the parameters which are not identical are
replaced by defaults. The default for both creator and file
type is ????, while the default for the finder flags is all-
zeroes. For example, when several text files with different
creators are merged into a single file, the new file has a
???? creator but is of type TEXT.
Dates
When copying files, MacDOS assigns to the destinations the
same creation and modify dates of the corresponding
sources. When several files are merged into one
destination, MacDOS ignores the source dates and sets the
destination date to the current date and time on copy
completion.
The /U switch
You can use the switch /U to implement a simple backup
batch program, as only files updated after the last COPY
are actually copied.
Order of copying
To know the order in which groups of files are copied,
execute a DIR command with no sorting options. This might
be important when several files are merged into one.
Copying of resource forks
Note that MacDOS does not merge resource forks when
concatenating files. Therefore, it really only makes sense
to append data forks. If you do concatenate files which
have resource forks, the resource forks appended to the
first one will not be accessible via ResEdit or similar
editors.
Examples
In all the following examples, \Dir1 contains: "FILE1.TXT",
"FILE1 TXT", "FILE2 TXT", "FI TXT", "FI BLA", "FILE1 BLA",
"FILE3 BLA", "FILE1 ZAP", "FILE3 ZAP", and folder "Dir2",
while Dir2 is empty. The attach point is Dir2.
COPY Dir1\*.*
Dir2 then contains FILE1.TXT
COPY "Dir1\FILE3 ZAP" Dir1\ZZZ
Dir2 remains empty, but a copy of "FILE3 ZAP" named ZZZ is
made in Dir1
COPY "Dir1\*1 *" ZZZ
Dir2 then contains ZZZ, which is the result of
concatenating "FILE1 TXT", "FILE1 BLA", and "FILE1 ZAP"
COPY DIR1\*3*, Dir1\*2* Z23
Dir2 then contains Z23, which is the result of
concatenating "FILE3 BLA", "FILE3 ZAP", and "FILE2 TXT"
COPY Dir1\*2*,Dir1\*1.* Dir1\FILE1.TXT
Dir2 remains empty, but the file "FILE2 TXT" is appended to
FILE1.TXT in Dir1.
COPY Dir1 Dir2 or
COPY Dir1\FI* Dir2 or
COPY ..\*?*?* \Dir1\Dir2
Dir2 then contains "FILE1.TXT", "FILE1 TXT", "FILE2 TXT",
"FI TXT", "FI BLA", "FILE1 BLA", "FILE3 BLA", "FILE1 ZAP",
and "FILE3 ZAP"
Frequently occurring errors
E13: Syntax: invalid arguments
This error is generated in a number of occasions. Check
that the destination argument is either a folder name or a
filename without wildcards. Also check that a list of
source filenames does not end with a comma, as commata are
only allowed between source files.
E27: File or directory not found
The source parameter did not identify any file at all or
one of the folders specified in the path could not be
found. Note that creator and file type are case sensitive.
Therefore, /T=text will not find any file of type TEXT.
E28: Bad switch
Perhaps you failed to specify a creator or file type
correctly. The equal sign is mandatory and all four
characters which form the OSType must be provided.
DATE
displays and sets the system date and the date format.
MacDOS uses the format set through DATE whenever it needs
to display a date (starting a LOG file, in a DIR listing,
etc.).
Syntax
date [format | date]
Parameters
format
is a string which specifies order and number of digits of
year, month, and day. It also specifies the separators to
be used between the fields. The default format is
yyyy/mm/dd. The characters 'y', 'm', and 'd' used to
specify the date format can be in upper or lower case.
date
is the new system date. It is specified in the current
format. The Macintosh only accepts dates in the interval
1904 to 2040.
Without parameters, DATE displays the current system date
in the current format and prompts you for input. You can
reply with either a new date or a new format. If you want
to leave both system date and format unchanged, hit the
return key.
MacDOS vs DOS
DOS does not let you change the date format via the command
DATE.
Notes
Parameter or not parameter
You will probably execute DATE interactively when changing
the system date. In that case, execute DATE without
parameter, so that MacDOS displays the current settings
before prompting you for the new date. This will ensure
that you use the correct format when typing the new date.
Format default
Format settings are forgotten when you quit MacDOS.
Therefore, it is advisable that you write in autoexec.bat a
DATE command which specifies your preferred format.
Formats in input and in output
MacDOS allows some flexibility when a new date is set:
• It ignores leading zeroes. For instance, 00001998, 008,
and 0000998 all indicate the year 1998 regardless of
whether the year is being displayed as 0001998, 1998, or
0000000001998 (with formats yyyyyyy, yyyy, and
yyyyyyyyyyyyy respectively).
• It accepts a full value also when its number of digits
exceeds the field length. For instance, 1998, 998,
00098, and 008 are all valid inputs regardless of
whether the format is yyyyyy, yyy, y, or yyy. This
applies to months and days as well, so that October,
November, and December can be entered when the length of
the month field is a single character.
• It uses the current year as a base for the new year
setting. For instance, if the current year is 1998, some
of the possible inputs to change it to 1999 are:
0001999, 09, 99, 1999, 00999, and 0000099.
The bottom line is that you can choose the output format
for dates without imposing too many constraints in input:
as long as you type the correct number of fields in the
correct order and with the correct separators, you will
probably be ok.
Examples
The following examples illustrate how to change the date
format. The 5th day of December 1949 (my birthday!) is used
to show the result of the change.
date mm/dd/yy 12/05/49
date dd/MM/yyyy 05/12/1949
date yy-m;ddddd 49-2;00005
date yyYYyyy/dd 0001949/05
date yyy 949
date dd mmKyy 05 12K49
date YY/ 49
As you can see, you can mix and match year, month, and day
as you please. Separators must be present and must be
single characters but they can be different from each
other. The characters yYmMdD0123456789 cannot be used as
separators.
Some invalid date formats are:
mm/dd//yy double separator
mmJJdd double separator
yyyyDmm 'D' is not a valid separator
mm1dd2yy '1' and '2' are not valid separators
When setting the system date, you have to follow the
current format, but leading zeroes can be omitted.
date 10/11/12 sets completely different dates depending on
the format and the current date. If the current date is
January 1st 1993, here are some possible outcomes:
format: mm/dd/yy date: 11th October 1912
format: dd/mm/yy date: 10th November 1912
format: yy/mm/dd date: 11th December 1910
If the current date is January 1st 2001, the same formats
result in the following dates:
format: mm/dd/yy date: 11th October 2012
format: dd/mm/yy date: 10th November 2012
format: yy/mm/dd date: 11th December 2010
This is due to the fact that MacDOS adds the leading digits
of the year on the basis of the current year.
The following examples show some valid combinations of date
formats and date inputs:
format current date date input resulting date
yyyy 16 Aug 1993 4 16 Aug 1994
y/m/d 20 Dec 2001 5/4/3 03 Apr 2005
mmmm/dd 07 Mar 1998 1/1 01 Jan 1998
dd-mm-yy 07 Mar 1998 7-3-2000 07 Mar 2000
And here are some examples of date inputs which would be
rejected:
format current date date input why
yyyy 16 Aug 2000 41 year > 2040
y/m/d 20 Dec 2001 5/4/31 April has 30 days
yy 29 Feb 1996 8 1998 not a leap year
dd;mm;yy 13 Mar 1997 14;3 year is missing
dd;mm;yy 13 Mar 1997 14;;98 month is missing
mm-dd-yy 13 Mar 1997 0-15-98 day < 1
Frequently occurring errors
E47: Invalid date or date format
You probably used the wrong separators or omitted some
fields.
See Also
TIME
DECR
decrements or shortens values of global variables.
Syntax
decr [+ | -]var [by {number | string}]
"decr var", equivalent to "decr +var by 1", decrements by 1
numeric values and removes one character from the end of
alphanumeric strings.
Parameters
[+ | -]var
is the name of a global variable, possibly preceded by a
plus or a minus sign. No space is allowed between the sign
and the variable name. DECR uses the sign to decide whether
to perform string operations at the end or at the beginning
of var's value.
number
is a signed integer number. DECR uses number differently
depending on whether var contains a numeric value or not:
• When var contains a numeric value, DECR replaces it with
the value obtained after subtracting number.
• When var contains an alphanumeric string which cannot be
interpreted as a number, DECR removes from it number
characters. The characters are removed from the
beginning if the variable name is preceded by the minus
sign, otherwise they are removed from its end. When
number is negative, DECR actually extends the content of
var by appending or prepending spaces (depending on the
presence of the minus sign before the variable name).
string
is an alphanumeric string which cannot be interpreted as a
number. DECR removes string from the string contained in
var. The string is removed from the beginning if the
variable name is preceded by the minus sign, otherwise the
string is removed from its end.
MacDOS vs DOS
DOS does not support DECR.
Notes
Removing numeric characters
When the BY-string is numeric, DECR decrements a numeric
variable by that amount or removes that number of
characters from an alphanumeric variable. If your purpose
is to remove digits from a variable (eg. the terminating
'1' from the string "1341"), you can achieve this result by
adding an alphabetic character to the variable before
removing the digit (ie. INCR var BY x followed by
DECR var BY 1x).
Decrementing too much
When the number of characters that you want to remove from
a string is greater than the length of the string, DECR
removes all the characters contained in the variable
without returning any error. The variable is then
automatically removed from the environment if it is user-
defined, or reset to its default if it is a system
variable.
Examples
initial var command resulting var
"25" decr var "24"
"25" decr -var "24"
"+25" decr var by 30 "-5"
"25" decr var by -3 "28"
"-7" decr var by -30 "23"
"abcde" decr var "abcd"
"abcde" decr -var "bcde"
"abcde" decr var by 3 "ab"
"abcde" decr var by -1 "abcde "
"abcde" decr -var by -3 " abcde"
"ab de" decr var by de "ab "
"a cde" decr -var by "a " "cde"
"abcde" decr +var by 7 var removed
"abcde" decr var by abcde var removed
"abcde" decr var by fgh fails
Frequently occurring errors
E63: Requested variable has not been defined
You attempted to DECRement a variable that did not exist.
Remember that empty variables are automatically removed
unless they are system variables.
E72: String search failed
This error is often due to the fact that DECR is case
sensitive. Therefore, the removal of a substring does not
succeed if you do not match upper and lower cases
sequences. You also get this error if you erroneously typed
DECR instead of INCR.
See Also
INCR, SSTR, TOUPPER
DEL, ERASE
remove from the system (ie. DELete) one or more files.
Syntax
del file [/C=creator] [/P] [/T=file type]
erase file [/C=creator] [/P] [/T=file type]
The two commands are functionally identical.
Parameters
file
is a name preceded by an absolute or relative path which
specifies the file or group of files to be deleted. A group
of files is identified via a wildcarded filename or a
folder name.
Switches
/C=creator
specifies that only files of a particular creator are to be
deleted. Note that no spaces are allowed on either side of
the equal sign and that the creator string is four
characters long. Therefore, if a creator includes spaces,
you must double quote the switch (eg. del \ "/c=ABC "
deletes all the files created by 'ABC ' in the root
folder).
/P
prompts you for confirmation before deleting each file.
/T=file type
specifies that only files of a particular type (eg. TEXT)
are to be deleted. Note that no spaces are allowed on
either side of the equal sign and that the file type is
four characters long. Therefore, if a file type includes
spaces, you must double quote the switch
(eg. del \ "/t=ABC " deletes all the files of type 'ABC '
in the root folder).
MacDOS vs DOS
The two implementations are identical.
Notes
Deleting everything
Under certain circumstances, MacDOS prompts you for
confirmation before beginning execution of the DEL command.
This happens when you type one of the following three
commands:
• DEL *
to delete all the files in the current folder.
• DEL *.*
to delete all the files of the current folder which have
a DOS-like name. This particular case has been copied
from DOS because DOS users would expect to be prompted.
• DEL foldname
to delete all the files in the folder named foldname.
MacDOS suppresses this prompt while executing in batch or
when you request to be prompted before deletion of each
individual file (CONFIRM is ON or the DEL option /P is
ON).
Deleting files vs removing folders
DEL only operates on files. Therefore, when you pass to DEL
the name of a folder, MacDOS deletes the files contained in
the folder rather than the folder itself. If you want to
remove a folder, you have to use RMDIR.
Trashing vs DELeting
DELetion is equivalent to moving files to the Trash Can and
then emptying the trash. That is, DELeted files are totally
removed from the system. If you want to have a behaviour
similar to the Macintosh Finder, use the batch program
trash.bat included as example in the MacDOS package.
Examples
DEL oldDocs /t=WDBN /p
deletes all MS-Word documents in the folder named oldDocs.
It also asks confirmation before deleting each file.
DEL * /t=TEXT /c=MSWD
deletes all text files produced with MS-Word in the current
folder.
DEL 1:\Trash
removes all the files contained in the Trash Can of the
start-up volume.
DEL 2:\*old*
deletes all the files in the root of volume 2 whose name
contains the string "old" (watch out; such a command also
deletes files like myGoldenFile, FOLDERlist, Soldano.txt,
etc. which are not necessarily old).
Frequently occurring errors
E27: File or directory not found
The file parameter did not identify any file at all.
Perhaps, you asked to delete the contents of a folder but
the folder did not contain any file.
See Also
RD, RMDIR